from collections import deque
from typing import List


class Solution:
    def ladderLength(self, beginWord: str, endWord: str, wordList: List[str]) -> int:
        wordList = set(wordList)
        if endWord not in wordList:
            return 0
        visited_start = {beginWord: 0}
        visited_end = {endWord: 0}
        queue_start = deque([beginWord])
        queue_target = deque([endWord])
        while queue_start and queue_target:
            if len(queue_start) <= len(queue_target):
                pass
